<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>CSS 盒模型</title>
  <style>
    html, body {
      padding: 0;
      margin: 0;
    }
  </style>
</head>
<body>
  <section id="sec">
    <style>
      #sec {
        background-color: red;
        overflow: hidden;
      }
      .child {
        margin-top: 10px;
        height: 100px;
        background-color: yellow;
      }
    </style>
    <article class="child"></article>
  </section>

  <h3>BFC垂直方向边距重叠</h3>
  <section id="margin">
    <style>
      #margin {
        background-color: pink;
        overflow: hidden;
      }
      #margin p {
        margin: 5px auto 25px;
        background-color: red;
      }
    </style>
    <p>1</p>
    <div style="overflow: hidden;">
      <p>2</p>
    </div>
    <p>3</p>
  </section>

  <h3>BFC 不与 float 重叠</h3>
  <section id="layout">
    <style>
      #layout {
        background-color: red;
      }
      #layout .left {
        float: left;
        width: 100px;
        height: 100px;
        background-color: pink;
      }
      #layout .right {
        height: 120px;
        background-color: #ccc;
        overflow: auto;
      }
    </style>
    <div class="left"></div>
    <div class="right"></div>
  </section>

  <h3>BFC 自元素即使是 float 也会参与高度计算</h3>
  <section id="float">
    <style>
      #float {
        background-color: red;
        /* overflow: hidden; */
        float: left;
      }
      .float {
        float: left;
        font-size: 30px;
      }
    </style>
    <div class="float">我是浮动元素</div>
  </section>
</body>
</html>
